<template>
  <div class="user">
    <div class="header">
      <div><img src="../assets/logo.dbd40807.png" alt="" class="logo" /></div>
      <div class="num">{{ username }}</div>
    </div>
    <div class="center">
      <div>
        <van-icon name="clock-o" size="40" @click="fn1" />
        <p>历史记录</p>
      </div>
      <div>
        <van-icon name="star-o" size="40" @click="fn2" />
        <p>我的收藏</p>
      </div>
      <div>
        <van-icon name="like-o" size="40" @click="fn3" />
        <p>我的点赞</p>
      </div>
    </div>
    <div class="footer">
      <van-cell-group>
        <van-cell title="推荐分享" value=">" size="large" />
        <van-cell title="意见反馈" value=">" size="large" />
        <van-cell title="关于我们" value=">" size="large" />
        <van-cell title="退出登录" value=">" size="large" @click="logout" />
      </van-cell-group>
    </div>
  </div>
</template>

<script>
export default {
  name: "HmUser",
  data() {
    return {
      username: localStorage.getItem("username"),
    };
  },
  methods: {
    logout() {
      localStorage.removeItem("token");
      localStorage.removeItem("username");
      this.$router.push("/LoginView");
    },
    fn1() {
      this.$router.push("/HmLayout/HmArticle");
    },
    fn2() {
      this.$router.push("/HmLayout/HmCollect");
    },
    fn3() {
      this.$router.push("/HmLayout/HmLike");
    },
  },
};
</script>

<style lang="less" scoped>
.user {
  background-color: #f5f5f5;
  width: 100vw;
  height: 100vh;
  box-sizing: border-box;
  padding: 10px;
}
.header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  .logo {
    width: 100px;
    margin-right: 10px;
  }
  .num {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
  }
}
.center {
  width: 100%;
  margin-bottom: 20px;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  background-color: #fff;
  height: 100px;

  div {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
  }
}
</style>
